package com.zql.LeetCode;

/**
 * 283. 移动零
 * Created By ShuHua on 2021/8/21.
 */
public class MoveZeroes_283 {
    public void moveZeroes(int[] nums) {

        if(nums==null||nums.length==1)return;

        int cur = 0;
        for(int i=0;i<nums.length;i++){
            if(nums[i]!=0){
                nums[cur++]=nums[i];
            }
        }
        if(cur==nums.length)return;
        for(int i=cur;i<nums.length;i++){
            nums[i]=0;
        }
    }
}
